;(function(FormBase) {
    FormBase.Identino = FormBase.extend({
        msgObj: { // error msg
            ID_NUM_ERROR: "请输入正确的18位身份证号码"
        },
        susFun: function() {},
        errFun: function() {},
        checkForm: function() {
            var regnum = /^[\d]{17}(\d|X|x){1}$/;
            var regFind = /[\d]{17}(\d|X|x){1}/;
            var regFind2 = /[\d]{0,17}/;
            var reg = /^[\d]{1,17}$/;
            var t1;
            if (this.newValue) {
                var identifyno = this.newValue.replace(/(^\s*)/g, "");
                if (identifyno.length > 18) { //长度超过18
                    t1 = regFind.exec(identifyno);
                    if (!t1) t1 = regFind2.exec(identifyno);
                    t1 = t1[0];
                    if (!t1) t1 = reg.exec(identifyno);
                    return {
                        status: false,
                        msg: this.getMsg("ID_NUM_ERROR"),
                        value: t1 ? t1 : ""
                    };
                } else if (identifyno.length == 18) { //长度为18
                    if (!regnum.test(identifyno)) {
                        t1 = regFind2.exec(identifyno)[0];
                        return {
                            status: false,
                            msg: this.getMsg("ID_NUM_ERROR"),
                            value: t1 ? t1 : ""
                        };
                    } else { //成功
                        return {
                            status: true,
                            msg: null,
                            value: this.newValue
                        };
                    }
                } else {
                    if (!reg.test(identifyno)) {
                        return {
                            status: false,
                            msg: this.getMsg("ID_NUM_ERROR"),
                            value: regFind2.exec(identifyno)[0]
                        };
                    }
                    return {
                        status: false,
                        //如果输入时提示错误则，msg:null,
                        msg: this.getMsg("ID_NUM_ERROR"),
                        value: this.newValue
                    };
                }
            }
            return {
                status: false,
                //如果输入时提示错误则，msg:null,
                msg: this.getMsg("ID_NUM_ERROR"),
                value: this.newValue
            };
        }

    });
})(window.FormBase = window.FormBase || {})
